<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ include file="/page/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/adapter/adapter-bootstrap.jsp"%>
<link
	href="${pageContext.request.contextPath}/frontframe/easyui/themes/easyui-extend.css"
	rel="stylesheet" type="text/css" />
<script type="text/javascript">
	function save() {
		if(!checkData()){
			return false;
		}
		var str_data = $("#form1 input").map(function() {
			return ($(this).attr("name") + '=' + $(this).val());
		}).get().join("&");
		$.ajax({
			url : "${ctx}/appTblUser/updateTblUserPwd",
			type : "POST",
			dataType : "json",
			data : str_data,
			async : false,
			success : function(data) {
				if (data.flag > 0) {
					alert("修改成功！");
					//window.location.reload();
				}
			},
			error : function() {
				alert("error");
			}
		});

	}
	
	function checkData(){
		var pwd1=document.getElementById("password").value;
		var pwd2=document.getElementById("pwd2").value;
		if(pwd1==null||pwd1==''||pwd1==undefined){
			alert("密码不能为空");
			return false;
		}
		if(pwd2==null||pwd2==''||pwd2==undefined){
			alert("密码不能为空");
			return false;
		}
		if(pwd1!=pwd2){
			alert("您两次输入的密码不一样，请重新输入");
			return false;
		}
		return true;
	}

	function goBack() {
		window.history.back(-1);
	}
</script>
</head>
<body>
	<div class="panel panel-default">
		<div class="panel-heading">
			<h3 class="panel-title">管理员信息页面</h3>
		</div>
		<div class="panel-body">
			<form class="form-horizontal" role="form" id="form1" name="form1" >
				<div class="form-group  text-center" style="text-align: center;">
					<label class="col-xs-2 control-label" for="password">新密码</label>
					<div class="col-xs-4">
						<input class="form-control" id="password" name="password" type="password" placeholder="" value=""/>
					</div>
					<input type="hidden" id="id" name="id" value="${appTblUser.id}"/>
					<input type="hidden" id="login_name" name="login_name" value="${appTblUser.login_name}"/>
				</div>
				<div class="form-group  text-center" style="text-align: center;">
					<label class="col-xs-2 control-label" for="pwd2">确定密码</label>
					<div class="col-xs-4">
						<input class="form-control" id="pwd2" name="pwd2" type="password" placeholder="" value=""/>
					</div>
				</div>
				<div class="form-group  text-center">
					<button type="button" class="btn btn-default" onclick="save();">修改</button>
					<button type="button" class="btn btn-default" onclick="goBack()">返回</button>
				</div>
			</form>
		</div>
	</div>

</body>
</html>
